package com.myorg.springmvctutorial.web.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.myorg.springmvctutorial.web.util.Person;

@Controller
public class HelloWorldController {
	protected final Log logger = LogFactory.getLog(getClass());

	@SuppressWarnings("deprecation")
	@RequestMapping("/helloWorld")
	public ModelAndView helloWorld(Map<String, Object> model) {

		List<Person> personList = new ArrayList<Person>();
		personList.add(new Person("Vasile", "Tataru", new Date(1950, 10, 12)));
		personList.add(new Person("Ion", "Rotaru", new Date(1960, 11, 12)));
		personList.add(new Person("Ion", "Placinta", new Date(1980, 1, 13)));
		model.put("personList", personList);
		logger.info("Return View");
		return new ModelAndView("helloworld.jsp");
	}

	
}